package com.xxgc.cloud.auth.springcloudauth.entity;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * <p>
 * 权限
 * </p>
 *
 * @author Mr.Abel
 * @since 2022-12-12
 */
@Getter
@Setter
  @ApiModel(value = "Permissions对象", description = "权限")
public class Permissions implements Serializable {

    private static final long serialVersionUID = 1L;

      @ApiModelProperty("权限id")
        @TableId(value = "id", type = IdType.AUTO)
      private Long id;

      @ApiModelProperty("权限名称")
      private String perName;

      @ApiModelProperty("权限描述")
      private String description;

      @ApiModelProperty("权限访问路径")
      private String url;

      @ApiModelProperty("权限标识")
      private String perms;

      @ApiModelProperty("父级权限id")
      private Long parentId;

      @ApiModelProperty("类型 0:接口 1:目录 2:菜单 3:按钮")
      private Integer perType;

      @ApiModelProperty("排序")
      private Integer perOrder;

      @ApiModelProperty("图标")
      private String icon;

      @ApiModelProperty("状态：0有效；1删除")
      private Boolean flag;

      @ApiModelProperty("创建时间")
      @TableField(fill = FieldFill.INSERT)
      @JsonDeserialize(using = LocalDateTimeDeserializer.class) // 反序列化
      @JsonSerialize(using = LocalDateTimeSerializer.class) // 序列化
      private LocalDateTime createTime;

      @ApiModelProperty("更新时间")
      @TableField(fill = FieldFill.INSERT_UPDATE)
      @JsonDeserialize(using = LocalDateTimeDeserializer.class) // 反序列化
      @JsonSerialize(using = LocalDateTimeSerializer.class) // 序列化
      private LocalDateTime updateTime;


}
